const mongoose = require('mongoose')

// 定义数据库字段
const schema = new mongoose.Schema({
    name:{type:String},
    //关联Category数据表，类型只能传对象的id
    parent:{type:mongoose.SchemaTypes.ObjectId,ref:"Category"}

})

//导出模型
module.exports = mongoose.model('Category',schema)